package basic;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

/**
 * @program: java-base->ParentAndSon
 * @description:
 * @author: G_Y
 * @create: 2019-09-18 15:30
 **/
public class ParentAndSon {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        Parent parent = new Son();
        System.out.println(parent.name);//parent
        Son son = new Son();
        System.out.println(son.name);
        parent.say();
        System.out.println(parent.getClass() == Son.class);
    }
}

class Parent {
    String name = "parent";
    public void say() {
        System.out.println("Parent");
    }
}

class Son extends Parent {
    String name = "son";
    public void say() {
        System.out.println("Son");
    }
}